package com.red.controller.user;

import com.red.entity.Orders;
import com.red.result.Result;
import com.red.service.OrderService;
import com.red.vo.OrderVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/user/order")
@ApiModel(value = "订单接口")
public class OrderController {
    @Autowired
    private OrderService orderService;


    /**
     * 查询所有订单
     * @return
     */
    @GetMapping
    @ApiModelProperty("查询所有订单")
    public Result<List<OrderVO>> selectAll(){
        List<OrderVO> ordersList = orderService.selectAll();
        return Result.success(ordersList);
    }
}
